package com.zaoniao.enstudy.domain.entity;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Getter
@Setter
@EqualsAndHashCode
public class FileImportData {

    /**
     * 单词
     */
    private String word;
    /**
     * 音标
     */
    private String phoneticSymbol;
    /**
     * 早鸟中文翻译
     */
    private String translation;
    /**
     * 单词例句1
     */
    private String wordEgOne;
    /**
     * 单词例句1翻译
     */
    private String wordEgOneTranslation;

    /**
     * 单词例句2
     */
    private String wordEgTwo;
    /**
     * 单词例句2翻译
     */
    private String wordEgTwoTranslation;

    /**
     * 年级.
     */
    private String grade;

    /**
     * 发音，音频链接地址.
     */
    private String pronunciation;

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {

        FileImportData.Converter INSTANCE = Mappers.getMapper(FileImportData.Converter.class);

        /**
         * dataList转doList 单词
         * @param dataList -
         * @return -
         */
        List<ZaoWord> data2doList(List<FileImportData> dataList);

        /**
         * dataList转doList 单词例句1
         * @param dataList -
         * @return -
         */
        List<ZaoWordExample> data2doList1(List<FileImportData> dataList);


        @Mapping(source = "wordEgOne", target = "example")
        @Mapping(source = "wordEgOneTranslation", target = "exampleTranslate")
        ZaoWordExample data2do (FileImportData data);

    }

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter2 {

        FileImportData.Converter2 INSTANCE2 = Mappers.getMapper(FileImportData.Converter2.class);

        @Mapping(source = "wordEgTwo", target = "example")
        @Mapping(source = "wordEgTwoTranslation", target = "exampleTranslate")
        ZaoWordExample data2do2 (FileImportData data);

        /**
         * dataList转doList 单词例句2
         * @param dataList -
         * @return -
         */
        List<ZaoWordExample> data2doList2(List<FileImportData> dataList);
    }
}
